-module(test1).
-export([test/0, first/0, second/0]).

first() ->
    io:format("~p requesting mutex~n", [self()]),
    mutex:wait(),
    receive cont -> ok end,
    io:format("~p releasing mutex~n", [self()]),
    mutex:signal().

second() ->
    io:format("~p requesting mutex~n", [self()]),
    mutex:wait(),
    mutex:signal().

test() ->
    F = spawn(test1, first, []),
    S = spawn(test1, second, []),
    receive after 1000 -> ok end,
    exit(S, kill),
    F ! cont,
    ok.
			 
		    
	   
	    
